package ru.spbu.mm.diploma.client.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
public class RightsService implements IRightsServiceConstants, IUserroleConstants {
    public static Map<Integer, List<String>> rightsMap = new HashMap<Integer, List<String>>();

    public void initRightsMap() {
        List<String> grantedPages = new ArrayList<String>();
        //granted pages for Division manager role
        //the same page accessible from project manager role and developer role
        grantedPages.add(PAGE_INDEX);
        grantedPages.add(PAGE_INTRA);
        grantedPages.add(PAGE_SEC_PROJECTS);
        grantedPages.add(PAGE_SEC_PROJECT_INFO);
        grantedPages.add(PAGE_SEC_MAIN);
        grantedPages.add(PAGE_GROUPS_AND_RISKS);
        rightsMap.put(USERROLE_DIVMNGR_ID, grantedPages);
        rightsMap.put(USERROLE_PRJCTMNGR_ID, grantedPages);
        rightsMap.put(USERROLE_DEVELOPER_ID, grantedPages);
        //granted pages for admin role
        List<String> grantedPagesAdmin = new ArrayList<String>();
        grantedPagesAdmin.add(PAGE_INDEX);
        grantedPagesAdmin.add(PAGE_INTRA);
        grantedPagesAdmin.add(PAGE_SEC_ADMIN);
        rightsMap.put(USERROLE_ADMIN_ID, grantedPagesAdmin);
    }
}
